package org.nf.web.servlet.adapter;

import org.nf.web.servlet.BaseView;
import org.nf.web.servlet.HandlerAdapter;
import org.nf.web.servlet.ServletApi;
import org.nf.web.servlet.resource.DefaultServletHttpRequestHandler;

/**
 * @author wangliang
 * @date 2024/5/22
 * 负责调用DefaultServletHttpRequestHandler，将请求转发给默认的Servlet处理
 */
public class DefaultServletRequestHandlerAdapter implements HandlerAdapter {

    @Override
    public boolean supports(Object handler) {
        return handler instanceof DefaultServletHttpRequestHandler;
    }

    @Override
    public BaseView handle(Object handler, ServletApi servletApi) throws Exception {
        DefaultServletHttpRequestHandler httpRequestHandler = (DefaultServletHttpRequestHandler) handler;
        httpRequestHandler.handleRequest(servletApi);
        return null;
    }
}
